package cn.tedu.deviceservice.controller;

import cn.tedu.charging.common.pojo.dto.GunStatusParam;
import cn.tedu.charging.common.pojo.vo.StationInfoVO;
import cn.tedu.charging.common.response.JsonResult;
import cn.tedu.deviceservice.service.DeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "设备模块")
@Slf4j
@RestController
@RequestMapping("/v1/device/")
public class StationController {
    @Autowired
    private DeviceService deviceService;

    @ApiOperation("获取站点信息")
    @GetMapping("station/info/{gunId}")
    public JsonResult getOrder(@PathVariable Long gunId){
        log.debug("C1-获取油枪信息-{}",gunId);
        StationInfoVO vo = new StationInfoVO();
        vo.setOperatorId(11l);
        vo.setStationId(11l);
        log.debug("C1-返回场站信息:{}",vo);
        return JsonResult.success(vo);
    }

    @ApiOperation("更新充电枪状态")
    @PutMapping("station/status/update")
    public JsonResult updateStatus( @RequestBody GunStatusParam gunStatusParam){
        log.debug("C2-更新充电桩信息:{}",gunStatusParam);
        //更新完毕
        return JsonResult.success();
    }

    @ApiOperation("查询附件充电桩")
    @GetMapping("near")
    public JsonResult getNearCharing(Double longitude,Double latitude,Double radius){
        log.debug("C3-查询附近充电桩,经度:{},纬度:{},半径:{}",longitude,latitude,radius);
        List<StationInfoVO> stationInfoVOS= deviceService.getNear(longitude,latitude,radius);
        return JsonResult.success(stationInfoVOS);
    }


}
